// j2g.cpp

#include <string>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <boost/date_time/gregorian/gregorian.hpp>

using namespace std;
using namespace boost::gregorian;

int main(int argc, char *argv[])
{
	string g_str1, g_str2;

	if(argc < 2)
	{
		cout << "Usage: g2j yyyymmdd" << endl;
		return 0;
	}
	else if(argc == 2)
	{
		g_str1 = argv[1];
		g_str2 = argv[1];
	}
	else if(argc >= 3)
	{
		g_str1 = argv[1];
		g_str2 = argv[2];
	}
	
	date d1 = from_undelimited_string(g_str1); 
	date d2 = from_undelimited_string(g_str2);
	
	if(d1 > d2)
	{
		swap(d1, d2);
	}

	day_iterator iter(d1);

	while(iter <= d2)
	{
		cout << iter->year()  
				<< setw(3) << setfill('0') <<  iter->day_of_year() << endl;
		++iter;
	}
	
	return 0;
}
